﻿#ifndef QPRINTERMANAGER_H
#define QPRINTERMANAGER_H

#include <QObject>
#include <QPrinter>
#include <QPrintPreviewDialog>
#include <QStandardItemModel>
#include "printsetting.h"

class QPrinterManager : public QObject
{
    Q_OBJECT
public:
    explicit QPrinterManager(QObject *parent = nullptr);

    //预览
    void preview();
    //打印
    void print();

    void setPrintSetting(PrintSetting *printSetting);

    void preparePrint(QStandardItemModel *model);

    void setHeaderList(QStringList headerList);

    void insertRowData(QStringList rowData);

signals:

public slots:
    void getPreviewData(QPrinter *printer);

private:
    QString getHearderHtml();

    QString getTemplateHtml();

    QStringList headerList;
    QString tableData;

    PrintSetting *printSetting;
};

#endif // QPRINTERMANAGER_H
